{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>系统配置</legend>
    </fieldset>
    <form class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <label class="layui-form-label">网站名称</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" name="site_name" value="{$system.site_name}" lay-verify="required"
                    placeholder="请输入网站名称" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">后台标题</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" name="background_title" value="{$system.background_title}"
                lay-verify="required" placeholder="请输入后台标题" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">酒店电话</label>
            <div class="layui-input-4">
                <input type="text" maxlength="20" name="phone" value="{$system.phone}" lay-verify="required|phone"
                    placeholder="请输入酒店电话" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">前台客服电话</label>
            <div class="layui-input-4">
                <input type="text" maxlength="20" name="tel" value="{$system.tel}" lay-verify="required"
                    placeholder="请输入前台客服电话" class="layui-input">
            </div>
        </div>
        



        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn" id="submit" lay-submit=""
                    lay-filter="sys">{:lang('submit')}</button>
            </div>
        </div>
    </form>
</div>
{include file="common/foot"/}
<script>
    layui.use(['form', 'layer', 'upload'], function () {
        var form = layui.form, layer = layui.layer, upload = layui.upload, $ = layui.jquery;

        form.verify({

            site_name: function (value) {
                if (value == '') {
                    return '请输入网站名称！';
                }
            },
            background_title: function (value) {
                if (value == '') {
                    return '请输入后台标题！';
                }
            },
            background_image: function (value) {
                if (value == '') {
                    return '请添加登录图！';
                }
            }
        });
       //提交监听
        form.on('submit(sys)', function (data) {
            $("#submit").attr({ disabled: "disabled" });
            loading = layer.load(1, { shade: [0.1, '#fff'] });
            $.post("{:url('system/index')}", data.field, function (res) {
                layer.close(loading);
                if (res.errorCode == 8888) {
                    layer.msg(res.msg, { icon: 1, time: 1000 }, function () {
                        location.href = res.url;
                    });
                } else {
                    $("#submit").removeAttr("disabled");
                    layer.msg(res.msg, { icon: 2, time: 1000 });
                }
            });
        })
    })


</script>


</body>

</html>